<template>
	<view class="passenger-flow">
		<view class="box_9">
			<!-- 选择会员 -->
			<view class="listall" style="margin-top: 20rpx;">
				<view class="d-flex flex-column listsee">
					<view class="d-flex flex-row justify-space-between">
						<view class="d-flex flex-row align-center">
							<view class="">
								<image style="width: 100rpx;height: 100rpx;border-radius: 50%;"
									:src="infoList.head_img"  mode=""></image>
							</view>
							<view class="d-flex flex-column" style="margin-left: 20rpx;">
								<view class="d-flex flex-row">
									<view class="" style="font-size: 26rpx;">
										{{infoList.name}}
									</view>
									<view class=""
										style="width: 100rpx;height: 40rpx;background: #e3ffe0;color: #69a66a;font-size: 22rpx;text-align: center;margin-left: 20rpx;line-height: 40rpx;">
										已认证
									</view>
								</view>
								<view class="" style="color: #c2c2c2;font-size: 24rpx;margin-top: 10rpx;">
									<text v-if="infoList.sex == 2">女</text>
									<text v-if="infoList.sex == 1">男</text>
									 | {{infoList.age}}岁 | {{infoList.birthday}}
								</view>
								<view class="" style="color: #c2c2c2;font-size: 24rpx;margin-top: 10rpx;">
									手机号码：{{infoList.mobile}}
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view>
				<scroll-view scroll-y class="listall" v-for="(item,index) in hylist" :key="index">
					<v-gap />
					<view class="d-flex flex-column listsee">
						<view class="d-flex flex-row justify-space-between">
							<view class="d-flex flex-row align-center">
								<view class="">
									<image style="width: 80rpx;height: 80rpx;"
										:src="item.cover" mode=""></image>
								</view>
								<view class="d-flex flex-column" style="margin-left: 20rpx;">
									<view class="" style="font-size: 26rpx;">
										{{item.train_name}}
									</view>
									<view class="d-flex flex-row align-center justify-center" style="margin-top: 10rpx;">
										<!-- <view class=""
											style="width: 80rpx;height: 40rpx;background: #edffeb;color: #7cc57e;font-size: 24rpx;text-align: center;margin-right: 20rpx;line-height: 40rpx;">
											新报
										</view> -->
										<view class="" style="font-size: 24rpx;">
											剩余{{item.left_num}}次
										</view>
									</view>
								</view>
							</view>
							<view class="d-flex flex-column align-center">
								<view class=""
									style="width: 80rpx;height: 40rpx;background: #edffeb;color: #7cc57e;font-size: 24rpx;text-align: center;line-height: 40rpx;">
									{{item.status_show}}
								</view>
								<!-- <view class=""  style="font-size: 24rpx;margin-top: 10rpx;">
									游泳短训计次
								</view> -->
							</view>
						</view>
						<!-- <view class="d-flex flex-row align-center" style="font-size: 24rpx;color: #9e9e9e;line-height: 50rpx;">
							<image class="" style="width: 20rpx;height: 20rpx;"
								src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a70accdc329c0011116ca9/16731594764081021110.png" />
							<view class="" style="margin-left: 10rpx;font-size: 24rpx; color: #b8b8b8;">
								2023-12-01 至 2024-06-30
							</view>
						</view> -->
						<view class="d-flex flex-row align-center" style="font-size: 24rpx;color: #9e9e9e;line-height: 50rpx;">
							<image class="" style="width: 20rpx;height: 20rpx;"
								src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a70accdc329c0011116ca9/16731594764081021110.png" />
							<view class="" style="margin-left: 10rpx;font-size: 24rpx; color: #b8b8b8;">
								课包规格：{{item.train_item_name?item.train_item_name:''}}
							</view>
						</view>
						<view class="d-flex flex-row justify-start align-center"
							style="font-size: 24rpx;color: #9e9e9e;line-height: 50rpx;">
							<view class="d-flex flex-row align-center" style="font-size: 24rpx;color: #9e9e9e;line-height: 50rpx;">
								<image class="" style="width: 20rpx;height: 20rpx;"
									src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a70accdc329c0011116ca9/16731594764081021110.png" />
								<view class="" style="margin-left: 10rpx;font-size: 24rpx; color: #b8b8b8;">
									校区：{{item.area_name?item.area_name:''}}
								</view>
							</view>
							<view class="d-flex flex-row align-center" style="font-size: 24rpx;color: #9e9e9e;line-height: 50rpx;margin-left: 20rpx;">
								<image class="" style="width: 20rpx;height: 20rpx;"
									src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61a70accdc329c0011116ca9/16731594764081021110.png" />
								<view class="" style="margin-left: 10rpx;font-size: 24rpx; color: #b8b8b8;">
									教练：{{item.coach_name?item.coach_name:''}}
								</view>
							</view>
						</view>
						<view class="d-flex flex-row justify-end"
							style="font-size: 24rpx;color: #9e9e9e;line-height: 50rpx;margin-top: 10rpx;">
							<view class=""
								style="width: 120rpx;height: 50rpx;background: #ffffff;color: #6d6d6d;font-size: 24rpx;text-align: center;line-height: 50rpx;margin-right: 20rpx;border: 1rpx #ababab solid;">
								课程反馈
							</view>
							<view class=""
								style="width: 120rpx;height: 50rpx;background: #5abdff;color: #ffffff;font-size: 24rpx;text-align: center;line-height: 50rpx;">
								查看课表
							</view>
						</view>
					</view>
				</scroll-view>

				<v-gap height="140rpx" color="#EDF5F5" />
			</view>
			
			<view class="d-flex flex-row justify-space-between justify-center align-center"
				style="position: fixed;bottom: 0;height: 120rpx;background-color: #fff;width: 100%;padding: 0 8%;z-index: 99;">
				<!-- <view class="" v-if="!plshow" @click="selectAllWeeks"
					style="width: 45%;height: 80rpx;background: #ffffff;color: #ff4040;font-size: 24rpx;text-align: center;border-radius: 35rpx;line-height: 80rpx;border:#ff4040 1rpx solid">
					重置
				</view> -->
				<view class="" @click="addstudent"
					style="width: 100%;height: 80rpx;background: linear-gradient(0deg, rgba(214, 53, 53, 0.9), rgba(255, 64, 64, 0.93), rgba(250, 142, 142, 0.93));color: #ffffff;font-size: 24rpx;text-align: center;border-radius: 35rpx;line-height: 80rpx;">
					新建课程
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const personal = require("@/api/personal/index.js");
	const venues = require("@/api/venues/venues.js");
	export default {
		data() {
			return {
				filterData: [],
				itemChooselist: {},
				venuelist: [],
				plshow: true,
				weekSelect: [], //选中的
				listQuery: { //分页
					pageNo: 1,
					pageSize: 7,
				},
				totalPage: '', //几页
				student_id: '',
				hylist:[],
				stuInfo:[],
				infoList:{}
			}
		},
		onLoad(options) {
			this.student_id = options.student_id
			this.pk_list()
		},
		methods: {
			async pk_list() {
				let that = this;
				if (this.listQuery.pageNo === 1) that.hylist = [];
				let params = {
					venue_id: this.itemChooselist.id,
					keyword: this.keyword,
					pageSize: this.listQuery.pageSize,
					page: this.listQuery.pageNo,
					student_id: this.student_id
				}
				let res = await venues.pk_list(params)
				if (res.code === 1) {
					that.hylist = that.hylist.concat(res.data.list.data); //将数据拼接在一起
					that.totalPage = res.data.list.last_page
					that.infoList = res.data.stuInfo
				}
			},
			// 下拉刷新
			onReachBottom() {
				if (this.totalPage <= this.listQuery.pageNo) {
					uni.showToast({
						title: '没有更多了',
						duration: 2000,
						icon: 'none'
					});
					return
				}
				this.listQuery.pageNo += 1
				this.pk_list()
			},
			plbatch() {
				this.plshow = !this.plshow
			},
			confirm(e) {
				uni.navigateTo({
					url: './shaixuan'
				})
				// this.indexArr = e.index;
				// this.valueArr = e.value;

			},
			confirm1(data) {
				this.itemChooselist.id = data
			    console.log(data, 'data');
			    // 直接根据接收到的 id 在 venuelist 中查找对应的场馆对象
			    const selectedItem = this.venuelist.find(item => item.id === data);
			    if (selectedItem) {
			        // 将找到的场馆对象赋值给 itemChooselist
			        this.itemChooselist = selectedItem;
			    } else {
			        console.log(`未找到 id 为 ${data} 的场馆对象`);
			    }
			},
			addstudent() {
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	// @import '../../static/css/member/member_index.scss';
	.passenger-flow {
		width: 100%;
		height: 100vh;
		display: flex;
		flex-direction: column;
		background-color: #EDF5F5;
		padding: 0rpx 0 50rpx 0;
		position: relative;

		.box_9 {
			width: 750rpx;
			height: 100%;
			// margin-bottom: 1rpx;
			display: flex;
			flex-direction: column;

			.tag-list {
				display: flex;
				margin-top: 30rpx;
				padding: 0 20rpx;

				/deep/ view {
					margin-left: 4rpx;
				}
			}

			.listall {
				.listsee {
					background-color: #fff;
					padding: 30rpx;
					border-radius: 10rpx;
					width: 94%;
					margin-left: 3%;
					border: 2rpx #fff solid;
				}

				.active1 {
					border: 2rpx #0000ff solid;
				}
			}

		}
	}
</style>